<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>关联会员</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.js"></script>
	</head>

    <style>
    	.layui-input, .layui-textarea{
    		width: 150px;
    	}
    </style>

	<body>
		<form class="layui-form update_form" action="">
			<div class="layui-form-item">
				<div class="layui-input-block update_shurk">
					<label class="layui-form-label">关联会员ID</label>
					<input type="text" name="user_id" id="user_id" value="{$tx_id}" placeholder="请输入关联会员ID" class="layui-input">
				</div>
			</div>  
			<div class="layui-form-item update_btnbox">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</body>

</html>
<script> 
	function to_money(){ 
		var user_id = $('#user_id').val(); 
		if(user_id == ''){
			layer.msg('请输入会员ID');
			return false;
		}
		$.ajax({
             	type:"post",
                url:"{:url('oem/index/get_city')}",
                data: { 
                	user_id	: user_id
                },
                success:function(data){
                	if(data.code == 200){
                		layer.msg(data.msg, {
                		    icon:1,
						    time: 1500 //2秒关闭（如果不配置，默认是3秒）
						}, function(){
							window.parent.location.reload();
							var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
							parent.layer.close(index);
						});
                	}else{
                		layer.msg(data.msg, {
                		    icon:5,
						    time: 1500 //2秒关闭（如果不配置，默认是3秒）
						});
                	}
                },error:function(data){
                	var a = data;
                }
        });
	}
	
	//Demo
	layui.use('form', function() {
		var form = layui.form;
		//监听提交
		form.on('submit(formDemo)', function(data) {
			//layer.msg(JSON.stringify(data.field));
			to_money();
			return false;
		});
	});
</script>